<template>
  <div>
    <div ref="echats1" style="width: 500px; height: 500px;"></div>
  </div>
</template>

<script>
// 引入echarts包
import * as echarts from 'echarts'
export default {
  // 页面加载完成,自动执行,调用函数
  mounted () {
    this.showCharts()
  },
  // vme
  methods: {
    showCharts () {
      // 初始化echarts,到div 元素中
      const myChart = echarts.init(this.$refs.echats1)
      const option = {
        xAxis: {
          data: ['A', 'B', 'C', 'D', 'E']
        },
        yAxis: {},
        series: [
          {
            data: [10, 22, 28, 43, 49],
            // 平滑曲线
            // smooth: true,
            type: 'line',
          }
        ]
      };
      myChart.setOption(option)
    }
  }
}
</script>

<style lang="scss" scoped></style>
